<template>
  <div style="height: 90%; width: 100%">
    <div :id="id" style="height: 100%; width: 100%"></div>
  </div>
</template>

 <script>
export default {
  name: "lineEcharts",
  props: {
    lineData: {
      type: Object,
      default: () => {
        return {};
      },
    },
    id: {
      type: String,
      default: () => {
        return '';
      },
    }
  },
  mounted() {
    this.getPie()
  },
  methods: {
    getPie() {
      var myChart = this.$echarts.init(document.getElementById(this.id));
      var option = {
        title: {
            left: 'center',
            text: this.lineData.title,
        },
        tooltip: {
          trigger: "axis",
        },
        grid: {
        //   left: "10px",
        //   right: "10px",
          bottom: "10px",
          containLabel: true,
        },
        xAxis: {
          data: this.lineData.xTime,
          type: "category",
          boundaryGap: true,
        },
        yAxis: {
          splitLine: {
            show: false,
          },
          axisLabel: {
            show: false,
          },
          axisTick: {
            //y轴刻度线
            show: false,
          },
          axisLine: {
            //y轴
            show: false,
          },
        },
        series: [
          {
            type: "line",
            data: this.lineData.data,
            itemStyle: {
              normal: {
                color: this.lineData.color,
                label: {
                  show: true,
                  position: "top",
                  textStyle: {
                    color: "#000000",
                  },
                },
              },
            },
          },
        ],
      };
      myChart.setOption(option);
    },
  },
};
</script>

 <style>
</style>
